home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Source / Asm / Fading / Morph.s < prev    next >
Encoding:
Text File  |  1998-02-28  |  3.7 KB  |  153 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Fades in a 32 colour picture, then fades it into a second purple palette,
  3. ;and then out to black.  Press left mouse button to exit.
  4.  
  5.     INCDIR    "INCLUDES:"
  6.     INCLUDE    "dpkernel/dpkernel.i"
  7.  
  8.     SECTION    "Demo",CODE
  9.  
  10. ;===========================================================================;
  11. ;                             INITIALISE DEMO
  12. ;===========================================================================;
  13.  
  14.     STARTDPK
  15.  
  16. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  17.     move.l    DPKBase(pc),a6
  18.     lea    PicFile(pc),a0
  19.     moveq    #ID_PICTURE,d0
  20.     CALL    Load
  21.     move.l    d0,Picture
  22.     beq.s    .Exit
  23.  
  24.     moveq    #ID_SCREEN,d0
  25.     CALL    Get
  26.     move.l    d0,Screen
  27.     beq.s    .Exit
  28.  
  29.     move.l    Picture(pc),a0
  30.     move.l    Screen(pc),a1
  31.     CALL    CopyStructure
  32.  
  33.     move.l    Screen(pc),a0
  34.     move.l    GS_Bitmap(a0),a1
  35.     clr.l    BMP_Palette(a1)
  36.     move.l    #BMF_BLANKPALETTE,BMP_Flags(a1)
  37.     sub.l    a1,a1
  38.     CALL    Init
  39.     tst.l    d0
  40.     beq.s    .Exit
  41.  
  42.     move.l    Picture(pc),a0
  43.     move.l    PIC_Bitmap(a0),a0
  44.     move.l    Screen(pc),a1
  45.     move.l    GS_Bitmap(a1),a1
  46.     CALL    Copy
  47.  
  48.     move.l    Screen(pc),a0
  49.     CALL    Show
  50.  
  51.     bsr.s    Main
  52.  
  53. .Exit    move.l    DPKBase(pc),a6
  54.     move.l    Screen(pc),a0
  55.     CALL    Free
  56.     move.l    Picture(pc),a0
  57.     CALL    Free
  58.     MOVEM.L    (SP)+,A0-A6/D1-D7
  59.     moveq    #ERR_OK,d0
  60.     rts
  61.  
  62. ;===========================================================================;
  63. ;                                MAIN CODE
  64. ;===========================================================================;
  65.  
  66. Main:    moveq    #$00,d7    ;d0 = FadeState
  67.     move.l    Screen(pc),a0
  68.     move.l    GS_Bitmap(a0),a5
  69.     move.l    SCRBase(pc),a6
  70. .f_in    CALL    scrWaitAVBL
  71.     move.l    Screen(pc),a0
  72.     move.l    Picture(pc),a1
  73.     move.l    PIC_Bitmap(a1),a1
  74.     move.l    BMP_Palette(a1),a1    ;a1 = Palette to fade to.
  75.     addq.w    #8,a1
  76.     moveq    #5,d1    ;d1 = Speed of fade.
  77.     moveq    #$000000,d2
  78.     moveq    #00,d3
  79.     move.l    BMP_AmtColours(a5),d4
  80.     move.w    d7,d0
  81.     CALL    scrColourToPalette    ;Do the fade routine.
  82.     move.w    d0,d7    ;Has the fade finished yet?
  83.     bne.s    .f_in    ;If not, keep doing it.
  84.  
  85.     move.l    DPKBase(pc),a6
  86.     moveq    #50,d0
  87.     CALL    WaitTime
  88.  
  89.     moveq    #$00,d7    ;d0 = FadeState
  90.     move.l    SCRBase(pc),a6
  91. .f_mid    CALL    scrWaitAVBL
  92.     move.l    Screen(pc),a0
  93.     moveq    #2,d1    ;d1 = Speed of fade.
  94.     move.l    Picture(pc),a1
  95.     move.l    PIC_Bitmap(a1),a1
  96.     move.l    BMP_Palette(a1),a1    ;a1 = Palette to fade to.
  97.     addq.w    #8,a1
  98.     lea    MorphPalette(pc),a2    ;a2 = Destination Palette.
  99.     move.w    d7,d0
  100.     CALL    scrPaletteMorph    ;Do the fade routine.
  101.     move.w    d0,d7    ;Has the fade finished yet?
  102.     bne.s    .f_mid    ;If not, keep doing it.
  103.  
  104.     move.l    DPKBase(pc),a6
  105.     moveq    #50,d0
  106.     CALL    WaitTime
  107.  
  108.     moveq    #$00,d7    ;d0 = FadeState
  109.     move.l    SCRBase(pc),a6
  110. .f_out    CALL    scrWaitAVBL
  111.     move.l    Screen(pc),a0
  112.     moveq    #2,d1    ;d1 = Speed of fade.
  113.     lea    MorphPalette(pc),a1
  114.     moveq    #$000000,d2
  115.     move.w    d7,d0
  116.     CALL    scrPaletteToColour    ;Do the fade routine.
  117.     move.w    d0,d7    ;Has the fade finished yet?
  118.     bne.s    .f_out    ;If not, keep doing it.
  119.  
  120.     move.l    DPKBase(pc),a6
  121.     moveq    #25,d0
  122.     CALL    WaitTime
  123.     rts
  124.  
  125. ;===========================================================================;
  126. ;                                  DATA
  127. ;===========================================================================;
  128.  
  129. Screen:    dc.l    0
  130. Picture    dc.l    0
  131.  
  132. MorphPalette:
  133.     dc.l    $000000,$0A0107,$14020E,$1D0314
  134.     dc.l    $27041B,$310522,$3B0629,$45082F
  135.     dc.l    $4E0936,$580A3D,$620B44,$6C0C4A
  136.     dc.l    $760D51,$800E58,$890F5F,$931066
  137.     dc.l    $9D116C,$A71273,$B1137A,$BA1481
  138.     dc.l    $C41687,$CE178E,$D81895,$E2199C
  139.     dc.l    $EB1AA2,$F51BA9,$FF1CB0,$D71C9F
  140.     dc.l    $557D55,$707082,$443300,$1E1E1E
  141.  
  142. PicFile    FILENAME "GMS:demos/data/PIC.Loading"
  143.  
  144. ;===========================================================================;
  145.  
  146. ProgName:    dc.b  "Palette Morph",0
  147. ProgAuthor:    dc.b  "Paul Manias",0
  148. ProgDate:    dc.b  "January 1998",0
  149. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  150. ProgShort:    dc.b  "Fading demonstration.",0
  151.         even
  152.  
  153.